package Suanfa;

import java.util.Scanner;
public class Jiekou01 {
    public static void main(String[] args) {
      CollectionBook book1=new CollectionBook("曼殊沙华","人世出版社","123","人界书库");
      CollectionBook book2=new CollectionBook("曼殊沙华","人世出版社","456","人界书库");
        System.out.println(book1);
        System.out.println(book2);
        System.out.println(book1.Equals(book2));
        Scanner reader=new Scanner(System.in);
        int n=reader.nextInt();
        if (n==0){
            book1.borrow();
        }
        else if (n==1){
            book1.revert();
        }
        Book book3=new Book("Java程序设计","清华出版社");
        System.out.println(book3.name);
        System.out.println(book3.publisher);
    }
}
interface Library{
      void borrow();
      void revert();
}
 class Book{
     String name;
     String publisher;
      public  Book(String name,String publisher){
          this.name=name;
          this.publisher=publisher;
     }
     public String getterName(){
          return name;
     }
     public void setterName(String name) {
          this.name = name;
     }
     public boolean Equals(Book book){
          if (this.name.equals(book.name)&&this.publisher.equals(book.publisher)){
               return true;
          }
          else{
               return false;
          }
     }
     public String toString(){
               name= "Java程序设计";
          return name;
     }
     public String toString(String publisher){
         this.publisher=publisher;
         publisher= "清华大学出版社";
          return publisher;
     }
}
 class CollectionBook extends Book implements Library {
      String bNo;
      String stacks;
      boolean isBorrow;

      public CollectionBook(String name, String publisher,String bNo,String stacks) {
           super(name, publisher);
           this.bNo=bNo;

      }
      public void borrow() {
          if(isBorrow==false){
              System.out.println("对不起该书已借阅");
          }
          else{
              System.out.println("借阅成功");
          }
      }
      public void revert() {
          if (isBorrow==false){
              System.out.println("该书已归还");
          }
          else{
              isBorrow=true;
              System.out.println("还书成功");
          }
      }
 }
